    IOI.25 (Icosaedru) Se considera un icosaedru (un poliedru regulat convex cu 20 fete) avnd
fetele numerotate ntr-un mod dat de la 1 la 20. Prin rostogolire completa a icosaedrului ntelegem
trecerea succesiva de la o fata la alta, adiacenta ei, astfel nct sa fie parcurse toate fetele exact odata.
Costul unei rostogoliri complete este de:
                                              c=1*f(1)+2*f(2)+..+20*f(20)
unde f(1),f(2),..,f(20) sunt n ordine fetele care se parcurg. Se cere sa se determine o
rostogolire completa de costminim, plecnd de la fata numerotata cu 1, n urmatoarele situatii:

              1. Doua fete se numesc adiacente daca au o muchie comuna;
              2. Doua fete se numesc adiacente daca au cel putin un punct comun.
===================================================
Solutia 1 (Catalin Francu)
program Icosaiedru;
{$B-,I-,R-,S-}
type FaceType=array[1..9] of Integer;
     IcosType=array[1..20] of FaceType;
     IntegerVector=array[1..20] of Integer;
var P:IcosType;
    BestRoute,Route:IntegerVector;
    Seen:set of 1..20;
    Cost,BestCost,Neighbours:Integer;

procedure ReadData;
var FileName:String;
    i,j:Integer;
begin
  WriteLn('Numele fisierului de intrare: ');ReadLn(FileName);
  Assign(Input,FileName);Reset(Input);
  for i:=1 to 20 do
    begin
      for j:=1 to 9 do Read(P[i,j]);
      ReadLn;
    end;
  ReadLn(Neighbours);
  if Neighbours=1 then Neighbours:=3 else Neighbours:=9;
  Close(Input);
end;

procedure IGotOne;
begin
  if Cost<BestCost then begin
                          BestRoute:=Route;
                          BestCost:=Cost;
                        end;
end;

procedure Walk(Face,Level:Integer);
var i:Integer;
begin
  if Level=21 then IGotOne
              else if (Cost<BestCost) and not (Face in Seen)
                     then begin
                            Route[Level]:=Face;
                            Seen:=Seen+[i];
                            Inc(Cost,Level*Face);
                            for i:=1 to Neighbours do
                              Walk(P[Face,i],Level+1);
                            Dec(Cost,Level*Face);
                            Seen:=Seen-[i];
                          end;
end;

procedure WriteSolution;
var i:Integer;
begin
  WriteLn('Costul optim este ',BestCost);
  Write('Drumul optim este ');
  for i:=1 to 20 do Write(Route[i],' ');
  WriteLn;
end;

begin
  ReadData;
  Cost:=0;
  Walk(1,1);
  WriteSolution;
end.
----------------------------------
